<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <style>
        div {
            position: absolute;
            width: 200px;
            height: 200px;
            background-color: skyblue;
        }
    </style>
</head>

<body>
    <button>动起来</button>
    <div>今天天气不错</div>
    <script>
        /* 
            语法：
                animate(params, [speed], [easing], [fn]);
            参数：
                params: 想要更改的样式，以对象形式传递，必写。    
                        属性名可以不带引号，驼峰命名法        
        */

        $(function () {
            $('button').click(function () {
                $('div').animate({
                    width: 300,
                    height: 300,
                    top: 200,
                    left: 400,
                    opacity: 0.5
                }, 2000, function () {
                    console.log(`回调函数`);
                    $('div').css('backgroundColor', 'green');
                });
            });
        });


    </script>
</body>

</html>